package com.isunland.managesystem.ui;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BasePagerActivity;
import com.isunland.managesystem.entity.BookOrderInfo;

/**
 * 对象功能: 预约下单pager页.
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: wangyanan
 * 创建时间: 2016/12/12 19:36
 */

public class AppointmentOrderPagerActivity extends BasePagerActivity {
  public static final String EXTRA_TASK = "com.isunland.intelligentFarmbyWJ.EXTRA_TASK";
  private String mId;
  private BookOrderInfo mItem;

  public static void newInstance(Fragment fragment, Activity context, BookOrderInfo item,
      int requestCode) {
    if (fragment == null || context == null) return;
    Intent i = new Intent(context, AppointmentOrderPagerActivity.class);
    i.putExtra(EXTRA_TASK, item);
    fragment.startActivityForResult(i, requestCode);
  }

  public static void newInstance(Context context, BookOrderInfo item) {
    if (context == null) return;
    Intent i = new Intent(context, AppointmentOrderPagerActivity.class);
    i.putExtra(EXTRA_TASK, item);
    context.startActivity(i);
  }

  @Override protected void onCreate(Bundle arg0) {
    mItem = (BookOrderInfo) getIntent().getSerializableExtra(EXTRA_TASK);
    if (mItem != null) mId = mItem.getId();
    //if (mItem !=null) mId= "5fec0274-c371-11e6-8ba4-b82a72dbffec";
    super.onCreate(arg0);
  }

  @Override protected Fragment createFragmentOne() {
    return AppointmentOrderDetailFragment.newInstance(mItem);
  }

  @Override protected Fragment createFragmentTwo() {
    //return PayAndBackFragment.newInstance(mId, 0);
    return ReceviceOrderLogListFragment.newInstance(mId);
  }

  @Override public Fragment createFragmentThree() {
    return LocaleWorkQueryCountDiaryListFragment.newInstance(mId);
  }

  @Override protected int[] createTitle() {
    return new int[] {
        R.string.orderDetail, R.string.hasReceivedOrderList, R.string.operationDiary
    };
  }
}
